import axios from 'axios';

// Define your API endpoint
const API_ENDPOINT = 'http://127.0.0.1:5000/api/img_data'; // Replace with your actual API endpoint

/**
 * Fetch chart data from the API.
 * @returns {Promise} A promise that resolves to the response data.
 */
export function fetchCharts() {
  return axios.get(API_ENDPOINT)
    .then(response => {
      // Assuming the response data has a structure { charts: [url1, url2, ..., url8] }
      return response.data;
    })
    .catch(error => {
      console.error("Error fetching charts:", error);
      throw error; // Rethrow error to be handled by the caller
    });
}
